﻿CREATE PROCEDURE [dbo].[proc_Assets_Update]
	(
		@CategoryId int,
		@NameId int,
		@Description nvarchar(50),
		@CompanyId int,
		@DepartmentId int,
		@UserName nvarchar(50),
		@EName nvarchar(50),
		@StateId int,
		@Prices numeric(18,2),
		@DJUserName nvarchar(50),
		@DJDate datetime,
		@GGXH nvarchar(50),
		@GZDate datetime,
		@GId uniqueidentifier
	)
AS
	Update Assets Set
		CategoryId=@CategoryId,
		NameId=@NameId,
		Description=@Description,
		DepartmentId=@DepartmentId,
		UserName=@UserName,
		EName=@EName,
		StateId=@StateId,
		Prices=@Prices,
		DJUserName=@DJUserName,
		DJDate=@DJDate,
		GGXH=@GGXH,
		LyDate=getdate(),
		GZDate=@GZDate Where GId=@GId
		
		if(@EName = '')
			begin
				update Assets set LyDate=NULL Where GId=@GId 
			end
	RETURN
